package com.henry.chatkit.input

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.henry.chatkit.R
import com.henry.chatkit.utils.SizeUtils
import java.util.*

class InputMoreFragment : Fragment() {

    val REQUEST_CODE_FILE = 1011
    val REQUEST_CODE_PHOTO = 1012

    private var mBaseView: View? = null
    private var mInputMoreList: List<InputMoreActionUnit> = ArrayList()

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        mBaseView = inflater.inflate(R.layout.chat_input_more_fragment, container, false)

        val layout: InputMoreLayout = mBaseView!!.findViewById<InputMoreLayout>(R.id.input_extra_area)
        layout.initView(mInputMoreList)

        // FLEX chat input
        val lp: ViewGroup.LayoutParams = layout.layoutParams
        var hh = SizeUtils.dp2px(200)
        if (mInputMoreList.size < 5) {
            hh = SizeUtils.dp2px(90)
        }
        lp.height = hh
        layout.layoutParams = lp

        return mBaseView
    }

    fun setActions(actions: List<InputMoreActionUnit?>?) {
        mInputMoreList = actions as List<InputMoreActionUnit>
    }

}